
let list = [];
let tmp1 = ""
let tmp2 = ""
let tmp3 = ""
let tmp4 = "";
for (let i = 0; i <= 23; i++) {
    if (i < 9) {
        if (i == 0) {
            tmp1 = "0" + i + ":15";
            tmp2 = "0" + i + ":30";
            tmp3 = "0" + i + ":45";
        } else {
            tmp1 = "0" + i + ":00";
            tmp2 = "0" + i + ":15";
            tmp3 = "0" + i + ":30";
            tmp4 = "0" + i + ":45";
        }
    } else { 
        tmp1 = i + ":00";
        tmp2 = i + ":15";
        tmp3 = i + ":30";
        tmp4 = i + ":45";
    }
    if (i == 0) {
        list.push(tmp1);
        list.push(tmp2);
        list.push(tmp3);
    } else {
        list.push(tmp1);
        list.push(tmp2);
        list.push(tmp3);
        list.push(tmp4);
    }
}
list.push("24:00");-
console.log(list)


let str = "p5,p56"
let newStr = str.split(",")
console.log(newStr)   //不会改变原数组  [ 'p5', 'p56' ]

newStr2=newStr.map((item) => {
    return item.replace("p","")
})
console.log(newStr2)//['5', '56']

//从数组中找区间5-56之间的数据
//方法1:通过filter过滤的方法进行实现
let newStr3 = list.filter((item, index) => {
    return (index >= parseInt(newStr2[0]) && index <= parseInt(newStr2[1]))
})
//方法2:通过slice方法进行实现
//arrray.slice(start,end)
//start:截取的开始位置
//end:截取的结束位置  [stat,end)  结束位置不会截取，只会到上一个
let newStr4 = list.slice(parseInt(newStr2[0]), parseInt(newStr2[1])+1)

console.log('filter实现')
console.log(newStr3)


console.log('slice实现')
console.log(newStr4)
